package com.ddc.study.feature.query;

import com.ddc.study.base.BasePresenter;
import com.ddc.study.base.BaseView;
import com.ddc.study.entity.Article;
import com.ddc.study.entity.History;
import com.ddc.study.entity.HotKey;
import com.ddc.study.entity.MainData;

import java.util.List;

import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * Created on 2018/4/28.
 *
 * @author lshun
 * @version 1.0
 */
interface QueryContract {
    interface IModel {
        @Nullable
        List<HotKey> loadHotKey();

        @Nullable
        List<History> loadHistory();

        @Nullable
        MainData<Article> queryWord(@IntRange(from = 0) int page, String word);

        long handleKeywordToHistory(String keyword);

        boolean deleteWord(@NonNull String word);

        boolean deleteAllWords();
    }


    interface IView extends BaseView {
        void showHotKeyData(@Nullable List<HotKey> data);

        void showHistoryData(@Nullable List<History> data);

        void showQueryData(@Nullable MainData<Article> data);

        void showDeleteWordResult(boolean success);

        void showDeleteAllWordsResult(boolean success);
    }

    abstract class IPresenter extends BasePresenter<IView> {
        abstract void loadHotKey();

        abstract void loadHistory();

        abstract void queryWord(@IntRange(from = 0) int page, String word);

        abstract void deleteWord(@NonNull String word);

        abstract void deleteAllWords();
    }
}
